package tron.entity;

import javax.persistence.*;

/**
 * 一对多演示
 */

@Entity
public class Children {
    @Id
    private String id;
    private String name;

    @Column(name = "parent_id")
    private String parentId;

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "parent_id",insertable = false,updatable = false)
    private  User user;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Children{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", parentId='" + parentId + '\'' +
                '}';
    }
}
